package cn.fengzhilun.javase.day06;

import java.util.Date;
import java.util.Objects;

public class Employee {
	private String name;
	 private int age;
	protected char gender;
	 private double salary;
	//Date onboard;
	
	public Employee(String name) {
		this.name=name;
		System.out.println("带参数的构造器被调用了");
	}
	public Employee() {
		
		
		
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	public double getSalary() {
		return salary;
	}
	public void setSalary(double salary) {
		this.salary = salary;
	}
	
	private void foo() {
		System.out.println();
	}
	
	@Override
	public boolean equals(Object obj) {
		if(this==obj) {
			
			return true;
		}
		
		if(!(obj instanceof Employee)) {
			
			return false;
		}
		
		Employee other =(Employee) obj;
		
		if(this.age!=other.age) {
			return false;
		}
		
		if(this.gender!=other.gender) {
			return false;
		}
		
		if(this.name==null) {
			if(other.name!=null) {
				return false;
				
			}
			
		}else{
			if(!this.equals(other.name)) {
				return false;
				
			}
		}
		if(!Objects.equals(this.name,other.name )) {
			
			return false;
			
		}
		return true;
	}
	
}
